﻿using Gp.Scripts.Core;
using Gp.Scripts.GUI;
using System;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using NRFramework;

namespace Gp.Scripts.GUI
{
    public class PanelMain : PanelMainBase
    {
        private PanelMain_EventWidget _eventWidget;
        private PanelMain_TimeWidget _timeWidget;
        

        protected override void OnEnter()
        {
            _eventWidget = CreateWidget<PanelMain_EventWidget>(mEventWidget_UIWidgetBehaviour);
            _timeWidget = CreateWidget<PanelMain_TimeWidget>(mTimeWidget_UIWidgetBehaviour);
            EventHandler.DoSchedule(1f, UpdateTimeFlow);
        }
        

        private void UpdateTimeFlow(float deltaTime)
        {
            _timeWidget.SetDisplayTime(Global.Get<GreatMapSystem>().UpdateTime(deltaTime));
        }
    }
}